﻿//<TunynetCopyright>
//--------------------------------------------------------------
//<copyright>青岛拓宇网络科技有限公司 2005-2008</copyright>
//<version>V0.5</verion>
//<createdate>2008-5-12</createdate>
//<author>zhengw</author>
//<email>zhengw@tunynet.com</email>
//<log date="2008-5-12">创建</log>
//--------------------------------------------------------------
//</TunynetCopyright>

using System;
using System.Collections.Generic;
using System.Text;
using Tunynet.QingdaoCustoms.Common;

namespace ChinaCustoms.Qingdao.Workflow.Supports
{
    /// <summary>
    /// 子流程业务逻辑类
    /// </summary>
    public class SubFlows
    {
        /// <summary>
        /// 创建子流程
        /// </summary>
        public static void CreateSubFlow(SubFlowInfo subFlowInfo)
        {
            WorkflowTrackingDataProvider.Instance().CreateUpdateSubFlow(subFlowInfo, DataProviderAction.Create);
        }

        /// <summary>
        /// 更新子流程
        /// </summary>
        public static void UpdateSubFlow(SubFlowInfo subFlowInfo)
        {
            WorkflowTrackingDataProvider.Instance().CreateUpdateSubFlow(subFlowInfo, DataProviderAction.Update);
        }

        /// <summary>
        /// 获取子流程
        /// </summary>
        /// <param name="subFlowGuid">子流程Guid</param>
        public static SubFlowInfo GetSubFlow(Guid subFlowGuid)
        {
            return WorkflowTrackingDataProvider.Instance().GetSubFlow(subFlowGuid, null);
        }

        /// <summary>
        /// 根据所属子流程活动Guid 获取子流程
        /// </summary>
        /// <param name="activityGuid">活动原型Guid</param>
        public static SubFlowInfo GetSubFlowByActivityPrototypeGuid(Guid activityPrototypeGuid)
        {
            return WorkflowTrackingDataProvider.Instance().GetSubFlow(null, activityPrototypeGuid);
        }

    }
}
